function [arrayOfAllWeights, analyzedPathways] = ...
    analyze_pathway(currentPathway, analyzedPathways, numberOfPathway, arrayOfAllWeights,...
        model, minimumBiomassFlux, shouldReturnModel, defines)

    [pathwayStatstics,listOfPoolMetabolitesInPathway,zeroSolutionFBA, ...
        listOfPathwaysWhereReactionsArePresented, arrayOfWeightsOfPathway, zeroSolutionBiomassFBA, returnModel]= ...
            get_pathway_statistics(currentPathway, model, minimumBiomassFlux, ...
                shouldReturnModel, defines);

   if ~zeroSolutionFBA & ~zeroSolutionBiomassFBA
       arrayOfAllWeights = [arrayOfAllWeights; arrayOfWeightsOfPathway, numberOfPathway];
       [arrayOfAllWeights, e] = sortrows(arrayOfAllWeights,[-1 -2 -3 -4]);

       index = '';
       if length(arrayOfAllWeights(:,1)) > str2num(defines.numberOfBestPathwaysReturned) 
           arrTemporary = arrayOfAllWeights(length(arrayOfAllWeights(:,1)),:);
           index = arrTemporary(5);
           arrayOfAllWeights(length(arrayOfAllWeights(:,1)),:) = [];
       end
       
       resultsStructure = struct('PATHWAY','', ...
                            'MODEL','', ...
                            'STATISTICS', '', ...
                            'POOL_METABOLITES', '', ...
                            'ORGANISM_PATHWAYS', '', ...
                            'WEIGHTS_OF_PATHWAY', '', ...
                            'NUMBER_OF_PATHWAY',0);

      cPathway = {}; 
      for i=1:length(currentPathway)
          if currentPathway(i) == 'C'
              compoundStructure = get_compound_information(currentPathway(i,:));
              cPathway{i} = [currentPathway(i,:) ' - ' compoundStructure.NAME];
          else
              reactionStructure = get_reaction_information(currentPathway(i,:));
              cPathway{i} = [currentPathway(i,:) ' - ' reactionStructure.NAME];
          end
      end    
      resultsStructure.PATHWAY = equalise_lengths(cPathway);
      resultsStructure.MODEL = returnModel;
      resultsStructure.STATISTICS = pathwayStatstics;
      
      
      cPathway = {}; 
      for i=1:length(listOfPoolMetabolitesInPathway(:,1))
          compoundStructure = get_compound_information(listOfPoolMetabolitesInPathway(i,:));
          cPathway{i} = [listOfPoolMetabolitesInPathway(i,:) ' - ' compoundStructure.NAME];
      end    
      resultsStructure.POOL_METABOLITES = equalise_lengths(cPathway); 
      
   
      if ~isempty(listOfPathwaysWhereReactionsArePresented)
        resultsStructure.ORGANISM_PATHWAYS = equalise_lengths(listOfPathwaysWhereReactionsArePresented(:,1));
      end
      resultsStructure.WEIGHTS_OF_PATHWAY = arrayOfWeightsOfPathway;
      resultsStructure.NUMBER_OF_PATHWAY = numberOfPathway; 

      analyzedPathways = [analyzedPathways; resultsStructure];

      if ~isempty(index)
          analyzedPathwaysTemporary = analyzedPathways;
          for j = 1:length(analyzedPathwaysTemporary)
             pathTemporary = analyzedPathwaysTemporary(j);
             if isequal(pathTemporary.NUMBER_OF_PATHWAY, index)
                 analyzedPathways(j)=[];
             end
          end
      end
   end
end